package com.zlc.platform.controller;

import com.zlc.common.annotation.LogSaveAnnotation;
import com.zlc.common.common.constant.PlatConstant;
import com.zlc.common.core.sys.model.vo.MayanSysHolidayConfigVo;
import com.zlc.common.core.sys.service.MayanSysHolidayConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.Map;

@Slf4j
@Api(tags = "工作日历相关")
@RestController
@RequestMapping("/api/holiday")
public class SysHolidayController {

    @Autowired
    private MayanSysHolidayConfigService mayanSysHolidayConfigService;

    @ApiOperation(value = "设置工作日历")
    @PostMapping(value = "/setConfig")
    @LogSaveAnnotation(module = PlatConstant.UC_APP_MODULE, recordRequestParam = true, title = "设置工作日历", catalog = "基础配置/日历管理")
    public void setConfig(@RequestBody MayanSysHolidayConfigVo config) {
        mayanSysHolidayConfigService.setConfig(config);
    }

    @ApiOperation(value = "查询工作日历")
    @GetMapping(value = "/findAllHolidayConfig")
    public Map<String, Boolean> findAllHolidayConfig(@RequestParam(value = "year") Integer year) {
        return mayanSysHolidayConfigService.findAllHolidayConfig(year);
    }

    @PostMapping({"test"})
    public String test(@RequestBody Map<String, String> req) throws InterruptedException {
        Thread.sleep(1000000000);
        return "";
    }
}
